package com.shenzhen.horselive.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.shenzhen.horselive.R;
import com.shenzhen.horselive.beans.AuctionHallBean;
import com.shenzhen.horselive.utils.TimeUtils;

import org.jetbrains.annotations.NotNull;

import java.util.List;

public class AuctionHallAdapter extends BaseQuickAdapter<AuctionHallBean.DataBean, BaseViewHolder> {
    public AuctionHallAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, AuctionHallBean.DataBean bean) {
          baseViewHolder.setText(R.id.tv_addr,bean.getAreaName())
                  .setText(R.id.tv_time,bean.getOverTime())
                  .setText(R.id.tv_price,bean.getStartPrice()+"(蜂值)");
        baseViewHolder.setText(R.id.tv_time, TimeUtils.formatDuring(Long.parseLong(bean.getOverTime())*1000-System.currentTimeMillis()));

//        statusView状态
//         baseViewHolder.setText(R.id.tv_state,bean.getStatusView());
        //区分竞拍状态
          switch (bean.getStatus()){
              case 1:
                  break;
          }
    }

    @Override
    protected void convert(@NotNull BaseViewHolder holder, AuctionHallBean.DataBean item, @NotNull List<?> payloads) {
       //这里跟新时间的显示
        holder.setText(R.id.tv_time, TimeUtils.formatDuring(Long.parseLong(item.getOverTime())*1000-System.currentTimeMillis()));
    }
}
